import factory from './node/factory.js'
export default class CreateEvent {
    constructor(tagName, props, attr, data, mode, watcher) {
        this.tagName = tagName
        this.props = props
        this.attr = attr
        this.data = data
        //创建节点
        this.event = new factory().createEvent({ tagName: tagName, attr: attr })
        watcher.watchers = this
        if (mode) {
            this.value = mode ? mode.data.call(this) : ''
            this.key = mode.key
            this.event.updata(this.value[this.key])
            if (this.event.onchange) {
                this.event.onchange((e)=>{
                    this.value[this.key]=e.target.value
                })
            }
        }

    }
}